import axios from 'axios';
import Vue from 'vue';

const serve = axios.create({
	baseUrl:'/api',
	timeout:5000,
	headers:{'Content-Type':'application/json;charset=UTF-8'} ,//配置请求头
})
serve.interceptors.request.use(function (config) {
	var token = '123123123'
	
	if(token){
		config.headers['token']= token;  
        return config;
	}else{
		
	}
}, 
error => {
    return Promise.reject(error);
});
serve.interceptors.response.use(response => {
	if(response.data.code == 1){
		return response.data;
	}else{
		return response.data;
	}
}, 
error => {
	return Promise.reject(error)
})

export default serve;
